<template>
<div class="mt30">
    <!--form表单-->
    <el-form size="small" ref="form" :model="form" label-width="200px">
      <el-form-item :label="$t('plus.withdrawal_method')" v-if="list.length > 0">
        <el-checkbox-group v-model="form.payType">
          <el-checkbox
            v-for="(item, index) in list"
            :label="item.value"
            :key="index"
            >{{item.name}}</el-checkbox
          >
        </el-checkbox-group>
        <div class="tips"> {{$t('plus.wechat_payout_note')}} 

</div>
      </el-form-item>

      <el-form-item
        :label="$t('plus.min_withdraw_amount')"
        prop="minMoney"
        :rules="[{  required: true,  message: ' '}]"
      >
        <el-input
          v-model="form.minMoney"
          type="number"
          class="max-w460"
        ></el-input>
      </el-form-item>
      <el-form-item
        :label="$t('plus.commission_settlement_days')"
        prop="settleDays"
        :rules="[{  required: true,  message: ' '}]"
      >
        <el-input
          v-model="form.settleDays"
          type="number"
          class="max-w460"
        ></el-input>
        <div class="tips">
          <p> {{$t('plus.settlement_rule')}} 


</p>
          <p class="red"> {{$t('plus.settlement_tip')}} 


</p>
        </div>
      </el-form-item>

      <!--提交-->
      <div class="common-button-wrapper">
        <el-button
          size="small"
          type="primary"
          @click="onSubmit"
          :loading="loading"
          >{{$t('plus.submit')}}</el-button
        >
      </div>
    </el-form>
  </div>
</template>

<script>
import PlusApi from "@/api/plus.js";
export default {
  data() {
    return {
      /*form表单数据*/
      form: {
        payType: [10]
      },
      list: [],
      selectlist: [10],
      loading: false
    };
  },
  props: {
    settingData: Object
  },
  created() {
    this.form = this.settingData.settlement;
    this.list = this.settingData.payType;
    // this.list = [{name:1,value:2},{name:1,value:2}]
  },
  methods: {
    /*提交表单*/
    onSubmit() {
      let self = this;
      let params = self.form;
      self.$refs.form.validate(valid => {
        if (valid) {
          self.loading = true;
          PlusApi.settlement(params, true).then(data => {
            self.loading = false;
            ElMessage({
              message: $t("plus.setting_success"),
              type: "success"
            });
          }).catch(error => {
            self.loading = false;
          });
        }
      });
    }
  }
};
</script>

